// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
import App from './App'
import router from './router'
import store from './store'
import Es6Promise from 'es6-promise'
import Tools from '@/tools/tools'
import VueLazyload from 'vue-lazyload'
import 'bulma/css/bulma.min.css'

FastClick.attach(document.body)
Vue.config.productionTip = false
Es6Promise.polyfill()
const moment = require('moment')
require('moment/locale/zh-cn')
Vue.use(require('vue-moment'), {
  moment
})
Vue.use(Tools)

if (process.env.NODE_ENV === 'production') {
  document.addEventListener('deviceready', function () {
    Vue.use(VueLazyload, {
      preLoad: 1.3,
      error: 'static/image/icon_error.jpg',
      loading: 'static/image/icon_error.jpg',
      attempt: 1
    })
    new Vue({
      router,
      store,
      render: h => h(App)
    }).$mount('#app-box')
  }, false)
} else {
  Vue.use(VueLazyload, {
    preLoad: 1.3,
    error: 'static/image/icon_error.jpg',
    loading: 'static/image/icon_error.jpg',
    attempt: 1
  })
  new Vue({
    router,
    store,
    render: h => h(App)
  }).$mount('#app-box')
}
